﻿using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.Media;
using System;
using System.Collections.Generic;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;

namespace BeatingMole
{
    class CGuiSong:Game
    {
        #region "Variable"
        private Song _song;
        private int _volumn;
        private bool _isMute;
        private bool _isPlay;
        ContentManager _content;
        bool IsEnable;
        #endregion

        #region "Properties"
        public bool IsEnableGui
        {
            set { IsEnable = value; }
            get { return IsEnable; }
        }
        public Song Song
        {
            set { _song = value; }
            get { return _song; }
        }
        public int Volumn
        {
            set { _volumn = value; }
            get { return _volumn; }
        }
        public bool IsMute
        {
            set { _isMute = value; }
            get { return _isMute; }
        }
        public bool IsPlay
        {
            set { _isPlay = value; }
            get { return _isPlay; }
        }
        #endregion


        #region "Constructor"
        public CGuiSong(ContentManager content)
        {
            CInfoSong1 _infoSong1 = new CInfoSong1();
            _content = content;
            Song = _content.Load<Song>(_infoSong1.LinkSong);
            Volumn = 100;
            IsMute = false;
            IsPlay = true;
        }
        #endregion

        #region "Method"
        public void UpdateSong(GameTime gameTime)
        {
            //Xử lý IsPlay và IsMute
            if (IsMute == true)
            {
                Volumn = 0;
                MediaPlayer.Volume = Volumn;
            }
        }

        public void Draw()
        {
            if (IsPlay == true)
            {
                MediaPlayer.IsRepeating = true;
                MediaPlayer.Play(Song);
            }
        }
        #endregion

    }
}
